// search
import React, { Component } from "react";
import axios from 'axios'
export default class Search extends Component {
  search = () => {
    // console.log(this.searchInputRef);
    let{value}=this.searchInputRef
    console.log(value);
    // let axios=1
    axios.get(`https://api.github.com/search/users?q=${value}`).then(
        response=>{
            console.log('请求成功',response.data);
        },
        error=>{
            console.log('请求失败',error);
        }
    )
  };
  render() {
    return (
      <div>
        <input
          type="text"
          placeholder="请输入要搜索的内容"
          ref={(curNode) => {
            this.searchInputRef = curNode;
          }}
        />
        <button onClick={this.search}>search</button>
      </div>
    );
  }
}
